/**
 * @param {number} n
 * @return {number}
 */
 var nextGreaterElement = function(n) {
  let digits = [];
  while(n > 0) {
      digits.push(n % 10);
      n = Math.floor(n / 10);
  }
  const array2Num = (a) => a.reduce((a, b, i) => a + b*(10**i))
  let stack = [];
  
  return -1;
};

console.log(nextGreaterElement(12354))